﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AdvertismentManager.ascx.cs" Inherits="Web.Cms.Advertistment.AdvertismentManager" %>
<%@ Import Namespace="Module.BusinessLogic" %>
<%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %>
<%@ Register Assembly="FilePickerControl" Namespace="AWS.FilePicker" TagPrefix="cc1" %>
<%@ Register src="../AjaxCP/Paging.ascx" tagname="Paging" tagprefix="uc1" %>
<script type="text/javascript">
    $(function () {
        $("#<%=txtDatefrom.ClientID %>").datepicker({ showOn: 'button', buttonImage: '/App_Themes/Default/Images/calendar_red.gif', buttonImageOnly: true, dateFormat: "dd/mm/yy", changeMonth: true, changeYear: true });
        $("#<%=txtDateTo.ClientID %>").datepicker({ showOn: 'button', buttonImage: '/App_Themes/Default/Images/calendar_red.gif', buttonImageOnly: true, dateFormat: "dd/mm/yy", changeMonth: true, changeYear: true });
    });
</script>
<div class="cl5"></div>
<div class="rows">
    <div class="fl width70 title-text"><strong>Vị trí hiện thị:</strong></div>
    <div class="fl"><asp:DropDownList ID="dropPositionID" runat="server" CssClass="textbox-title" Height="20" Width="280">
         </asp:DropDownList>
    </div>
</div>
<div class="cl5"></div>
<div>
    <div class="fl width70 title-text"> <b>Ngày bắt đầu:</b></div>
    <div class="fl"><asp:TextBox ID="txtDatefrom" runat="server" Height="20px" Width="70"></asp:TextBox></div>
    <div class="fl title-text"><b>Ngày kết thúc:</b></div>
    <div class="fl"><asp:TextBox ID="txtDateTo" runat="server" Height="20px" Width="70"></asp:TextBox></div>    
</div>
<div class="cl5"></div>
<div class="rows">
    <div class="fl width70 title-text"></div>
    <div class="fl">
        <asp:Button runat="server" ID="btnTimKiem" CssClass="Button_Search" OnClick="btnTimKiem_Click"/>
        <a style="cursor:hand;" href="javascript:void(0)" onclick="javascript:return showPopWinADMIN('/cms/Advertistment/addEditBanner.aspx','Quản lý banner',720,400,null,null)">
                    <img src="../App_Themes/Default/Images/Add_b.gif" border="0" />
                </a> 
    </div>
</div>
<div class="cl5"></div>
<div style=" padding-left:50px;"><asp:Label Font-Bold="true" ForeColor="red" Font-Size="11px" ID="lblMessage" runat="server"></asp:Label></div>
<div class="cl5"></div>
<p class="heading">Danh sách banner quảng cao</p>
<div class="cl5"></div>
<table border="0" cellpadding="2" cellspacing="2" style="width: 100%">
    <tr>
        <td>
        </td>
        <td>
            <asp:Label ID="lblUpdateStatus" runat="server" ForeColor="red"></asp:Label></td>
    </tr>
    <tr>
        <td valign="top" colspan="2">
            <table border="0" cellpadding="2" cellspacing="2" style="width: 100%">
                <tr>
                    <td>
                        <asp:GridView ID="grdMedias" runat="server" AutoGenerateColumns="False" BorderColor="Gainsboro"
                            BorderStyle="Solid" BorderWidth="1px" CaptionAlign="Top" CellPadding="2" SkinID="AdminGrid"
                            OnRowCommand="grdMedias_RowCommand" 
                            OnRowDataBound="grdMedias_RowDataBound" Width="100%" PageSize="500">
                            <AlternatingRowStyle CssClass="Grid_Raw2" />
                            <RowStyle CssClass="Grid_Raw1" />
                            <HeaderStyle CssClass="Grid_Top" Font-Bold="True" />
                            <Columns>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        STT
                                    </HeaderTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="5px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblSTT" runat="server"></asp:Label>
                                        <asp:Label Visible="false" ID="lbAdvId" runat="server" Text='<%# Eval("AdvertisementID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Title" HeaderText="T&#234;n banner">                                  
                                </asp:BoundField>                               
                                <asp:TemplateField>
                                    <HeaderTemplate>Nhóm quảng cáo</HeaderTemplate>
                                    <ItemStyle Width="350px" HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <%# Eval("GroupAdvertisement")%>                                      
                                    </ItemTemplate>
                                </asp:TemplateField>                               
                                   <asp:TemplateField>
                                    <HeaderTemplate>
                                        Ảnh
                                    </HeaderTemplate>
                                    <ItemStyle Width="50px" HorizontalAlign="Center" />
                                    <ItemTemplate>
                                       <%# AdvertisementBL.GetMediaType(Convert.ToInt32(Eval("MediaType").ToString()))%>
                                    </ItemTemplate>
                                </asp:TemplateField>                           
                                <asp:BoundField DataField="StartDate" HeaderText="Ngày bắt đầu"  ItemStyle-Width="150px" />
                                <asp:BoundField DataField="EndDate" HeaderText="Ngày kết thúc" ItemStyle-Width="150px" />
                                                             
                               
                                <asp:TemplateField Visible="false">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="6px" HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:Button ID="btnSetIsEnable" CssClass="Button_using" runat="server" CommandName="SetIsEnable" />
                                        <br />
                                        <asp:CheckBox runat="server" ID="cboCheckIsEnable" />
                                        <asp:Label ID="lblIsEnable" runat="server"></asp:Label>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="cboIsEnable" runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Thứ tự">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="50px" />
                                    <HeaderTemplate>
                                        <asp:Button ID="btnSetOrder" runat="server" CommandName="setorder" SkinID="IconPriority" />
                                        <asp:Label ID="lblPriority" runat="server"></asp:Label>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:DropDownList ID="dropOrder" runat="server">
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField>
                                    <HeaderTemplate>
                                        Trạng thái</HeaderTemplate>
                                    <ItemTemplate>
                                           <asp:ImageButton ID="btnStatus" runat="server" CommandArgument='<%# Eval("AdvertisementID") %>' CommandName="CommandStatus" />
                                    </ItemTemplate>
                                    <ItemStyle Width="20px" />
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        chỉnh sửa
                                    </HeaderTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="10px" />
                                    <ItemTemplate>
                                        <img alt="" src="../App_Themes/Default/images/edit.gif" style="cursor:pointer"
                            onclick="showPopWinADMIN('/cms/Advertistment/addEditBanner.aspx?ctrlkey=<%=CurrentCommand.CtrlKey %>&advertisementID=<%# Eval("AdvertisementID") %>','<%# Eval("Title") %>',720,400,null,null);return false;" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <HeaderTemplate>Xóa</HeaderTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="10px" />
                                    <ItemTemplate>
                                        <asp:Button ID="btnDeleteMedia" runat="server" CommandArgument='<%# Eval("AdvertisementID") %>'
                                            CommandName="deletemedia" SkinID="IconDelete" OnClientClick="return confirm('Bạn có chắc chắn xóa không')" />
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<div class="cl5"></div>
<p style="text-align:center;">
    &nbsp;<uc1:Paging ID="Paging1" runat="server" />